﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AspNetMvc5.ExtJs.Models;
using Newtonsoft.Json;

namespace AspNetMvc5.ExtJs.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var list = new List<UserInfo>();
            list.Add(new UserInfo() { id = 1, account = "zhangxiaowei", lastname = "张小五", phone = "13918392143", age = 23, state = true });
            list.Add(new UserInfo() { id = 2, account = "chengxiriwei", lastname = "张理五", phone = "13548392143", age = 23, state = false });
            list.Add(new UserInfo() { id = 3, account = "zhkihyowei", lastname = "费雯五", phone = "1391678143", age = 23, state = false });
            list.Add(new UserInfo() { id = 4, account = "zoooowei", lastname = "程小北", phone = "13923492143", age = 23, state = true });
            list.Add(new UserInfo() { id = 5, account = "pppxiaowei", lastname = "张春秋", phone = "1876592143", age = 23, state = false });

            ViewBag.userStore = JsonConvert.SerializeObject(list);
            ViewBag.userCount = 5;
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}